<?php 
define('IN_MEDIA',true);
include ('../includes/_config.php');
include ('../includes/_string.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php  echo $web_title;;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="<?php echo $web_keywords ;?> ">
<link rel="SHORTCUT ICON" href="images/favi.ico" type="image/x-icon" />
<script src="scripts/jquery-1.2.6.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="styles/normal.css" type="text/css" />
<link rel="stylesheet" href="styles/register.css" type="text/css" />
</head>
<body>
<?php  include ('toptoolbar.php');?> 
<div id="outter">co
	<?php  include ('header.php');?> 
    <?php  include ('menu.php');?> 
	<div id="content">	
    <!--LEFT-->
	<div class="mainbody-content fl">		
    		<div class="group-folder">
                <!--# Categories -->
                <?php include ('leftbar.php');?>
             </div> <!--end #Categories-->
                <!--#Content-->
                <div class="content-center fr">               
              		<!--Mua bán - rao vặt-->
                   
                    <!--Việc làm -->
                    <div class="folder">
                          <div class="folder-title-new"><div class="square"></div>
        							<a>Mua bán - Rao vặt</a></div>
                          <div class="folder-body">  
                          <?php
						  	#LEVEL1
							if (!isset($_GET['id']))die ('');
							$page = isset ( $_GET["page"] ) ? intval ( $_GET["page"] ) : 1;
						  	if (isset($_GET['id'])){
							 	$idle3=level3($_GET['id'],($page-1)*25,25);
								foreach ($idle3 as $value){
									$item=new raovat;
									$item->tin($value);
									echo " <div class='item'>";
									if(strlen($item->img)<5)$img="images/noimage.gif";
									else $img=$item->img;
									echo "<div class='img'><img src='$img' height='35' width='35'></div>";
									echo " <div class='main_con'>
										<div class='tilte_post'>".$item->tilte." </div>
										<div class='info_sp'>
												<span>Người đăng: </span><a href=''>".$item->user."</a>
												<span> | Chuyên Mục: </span><a href=./view.php?id=".get_data("SP_ID","categories","SP_ID",get_data("SP_ID_FA","categories","SP_ID",$item->categories)).">".get_data("SP_NAME","categories","SP_ID",get_data("SP_ID_FA","categories","SP_ID",$item->categories))."</a> 
												<span> | Giá: </span><span class='gia'>".$item->cost."</span> vnđ 
										</div>
									</div>  </div>"	;						
									unset($item);
								}
							  
							 }
						  ?>
                          <ul id="paging">
                          <?php
						  //PHAN TRANG: NHỨC ĐẦU HJX HJX
						  $idle3=level3($_GET['id']);
						  $numPage=ceil(count($idle3)/25);	
						  unset( $idle3);
                          $pre="";
						  $first=""; 
						  $num="";
						  $dot="";
						  $end="";
						  $next="";
						  #PRE
						  if($page!=1)   $pre="<li><a href='view.php?id=".$_GET['id']."&page=".($page-1)."'>« Trước</a><li>"; 
						  #FIRST
						  if ($page==1)  $first="<li><a class='paging-active' href='view.php?id=".$_GET['id']."&page=1'>1</a><li>";
						  else $first="<li><a href='view.php?id=".$_GET['id']."&page=1'>1</a><li>";
						  #NUM
						  if ($numPage<=2) $num="";
						  elseif($page>($numPage-6)){
							  for($i=$numPage-6<2?2:$numPage-6;$i<$numPage;$i++){
									if ($i==$page) $num.="<li><a class='paging-active' href='view.php?id=".$_GET['id']."&page=".$i."'>".$i."</a><li>";	
									else $num.="<li><a href='view.php?id=".$_GET['id']."&page=".$i."'>".$i."</a><li>";	
									
							  }	
						  }
						  else  {
							  for($i=$page==1?2:$page;$i<$page+6;$i++){
										if ($i==$page) $num.="<li><a class='paging-active' href='view.php?id=".$_GET['id']."&page=".$i."'>".$i."</a><li>";	
										else $num.="<li><a href='view.php?id=".$_GET['id']."&page=".$i."'>".$i."</a><li>";	
									
							  }	
						  }
						  #DOT
						  if ($numPage>8&&$page<=($numPage-6))  $dot="<li><a >....</a><li>";
						  #END
						  if($numPage>1){
							   if ($page==$numPage) $end="<li><a  class='paging-active' href='view.php?id=".$_GET['id']."&page=".$numPage."'>".$numPage."</a><li>"; 
							   else $end="<li><a  href='view.php?id=".$_GET['id']."&page=".$numPage."'>".$numPage."</a><li>"; 
						  }
						  #NEXT
						  if($page!=$numPage)$next="<li><a href='view.php?id=".$_GET['id']."&page=".($page+1)."'>Sau »</a><li>"; 
						 
						  #PHAN TRANG
						  if ( $numPage!=0) echo $pre.$first.$num.$dot.$end.$next; 
						  ?>
                         
                    </ul>
                          </div>
                          <div class="folder-bottom">
                          <div class="square-bottom">
                          </div>
                          </div>
                          
                    </div> <!--End #Folder-->
                </div>	<!--end #Content-->	
           		 </div>
     <!--#below Content-->
	 <div class="folder">
				<div class="folder-top"><div class="square-top"></div></div>
				<div class="folder-body">
                	
                   
                </div>
                <div class="folder-bottom"><div class="square-bottom"></div></div>
			</div>	<!--end #below Content-->			
		</div> <!--end #LEFT-->
	
    <?php include ('rightbar.php') ;?> 
    
    <!--RIGHT--></div>
     <?php include ('footer.php') ;?> 
</div>

<!--end content -->	
</body>
</html>